<include file="public:header" />
<script type="text/javascript" src="../includes/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript">
	//编辑器
	KE.show({
		id : 'info',
		imageUploadJson : '../includes/kindeditor/php/upload_json.php',
		fileManagerJson : '../includes/kindeditor/php/file_manager_json.php',
		allowFileManager : true,
		afterCreate : function(id) {
			KE.event.ctrl(document, 13, function() {
				KE.util.setData(id);
				document.forms['myform'].submit();
			});
			KE.event.ctrl(KE.g[id].iframeDoc, 13, function() {
				KE.util.setData(id);
				document.forms['myform'].submit();
			});
		}
	});
	
$(function(){
	$("#add_attatch").click(function(){
		$("#attatch_tr").clone().prependTo($("#attatch_tr").parent());
	});
	$(".delete_attatch").click(function(){
		var article_id = $("#article_id").val();
		var aid = $(this).attr('aid');
		$.get("admin.php?m=article&a=delete_attatch&id="+article_id+"&aid="+aid, function(data){
			$("#list_"+aid).hide();
		});
	});
})
</script>

<form action="{:u('article/edit')}" method="post" name="myform" id="myform" enctype="multipart/form-data" style="margin-top:10px;">
  <div class="pad-10">
  <div class="col-tab">
  <ul class="tabBut cu-li">
    <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',2,1);">{$Think.lang.general_info}</li>
    <li id="tab_setting_2" onclick="SwapTab('setting','on','',2,2);">{$Think.lang.article_seo}</li>
  </ul>
  <div id="div_setting_1" class="contentList pad-10">
    <table width="100%" cellpadding="2" cellspacing="1" class="table_form">
      <tr>
        <th width="100">标题名称 :</th>
        <td><input type="text" name="title" id="title" class="input-text" size="60" value="{$article.title}"></td>
      </tr>
	  <tr>
        <th width="100">链接地址 :</th>
        <td><input type="text" name="url" id="url" class="input-text" size="60" value="{$article.url}"></td>
      </tr>
      <tr>
        <th>所属分类 :</th>
        <td><select name="cate_id" style="width:200px;">
        	<option value="0">--请选择分类--</option>
            <volist name="cate_list['parent']" id="val">
              <option  <if condition="$article['cate_id'] eq $val['id']"> selected="selected" </if> value="{$val.id}">{$val.name}</option>
              <notempty name="cate_list['sub'][$val['id']]">
                <volist name="cate_list['sub'][$val['id']]" id="sval">
                  <option <if condition="$article['cate_id'] eq $sval['id']"> selected="selected" </if> value="{$sval.id}">&nbsp;&nbsp;&nbsp;&nbsp;{$sval.name}</option>
                  <notempty name="cate_list['sub'][$sval['id']]">
                    <volist name="cate_list['sub'][$sval['id']]" id="ssval">
                      <option <if condition="$article['cate_id'] eq $ssval['id']"> selected="selected" </if> value="{$ssval.id}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$ssval.cate_name}</option>
                    </volist>
                  </notempty>
                </volist>
              </notempty>
            </volist>
          </select></td>
      </tr>
      <tr>
          <th>内容来源 :</th>
          <td><input type="text" name="orig" id="orig" class="input-text" value="{$article.orig}" size="30"></td>
      </tr>
      <tr>
      	<th>上传图片 :</th>
      	<td>
        	<input type="file" name="img" id="img" class="input-text" style="width:200px;" />
            <if condition="$article['img'] neq ''">
            <br /><img src="../includes/data/news/{$article.img}" style="border: 1px solid #999999;padding:1px;width:50px;height:50px;"/>
            </if>
        </td>
      </tr>
      <tr>
        <th>摘要简介 :</th>
        <td><textarea name="abst" id="abst" style="width:68%;height:50px;">{$article.abst}</textarea></td>
      </tr>
      <tr>
        <th>详细内容 :</th>
        <td><textarea name="info" id="info" style="width:70%;height:350px;visibility:hidden;">{$article.info}</textarea></td>
      </tr>
      <tr>
        <th>排&nbsp;序&nbsp;值 :</th>
        <td><input type="text" name="ordid" id="ordid" class="input-text" size="8" value="{$article.ordid}" ></td>
      </tr>
      <tr>
        	<th>热门推荐：</th>
        	<td>
            	<input type="checkbox" name="is_hot" id="is_hot" value="1" <if condition="$article['is_hot'] eq '1'">checked="checked"</if>> &nbsp;热门&nbsp;&nbsp;&nbsp;
                <input type="checkbox" name="is_best" id="is_best" value="1" <if condition="$article['is_best'] eq '1'">checked="checked"</if>> &nbsp;推荐&nbsp;&nbsp;&nbsp;
            </td>
          </tr>
      <tr>
        <th>审核状态 :</th>
        <td><input type="radio" name="status" class="radio_style" value="1" <if condition="$article.status eq 1"> checked</if>>
          &nbsp;已审核&nbsp;&nbsp;&nbsp;
          <input type="radio" name="status" class="radio_style" value="0" <if condition="$article.status eq 0">  checked</if>>
          &nbsp;未审核
          </td>
      </tr>
      <tr><td><input type="hidden" name="id" value="{$article.id}" id="article_id"/></td></tr>
    </table>
  </div>

  <div id="div_setting_2" class="contentList pad-10 hidden">
    <table width="100%" cellpadding="2" cellspacing="1" class="table_form">
      <tr>
        <th width="100">{$Think.lang.seo_title} :</th>
        <td><input type="text" name="seo_title" id="seo_title" class="input-text" size="60" value="{$article.seo_title}"></td>
      </tr>
      <tr>
        <th>{$Think.lang.seo_keys} :</th>
        <td><input type="text" name="seo_keys" id="seo_keys" class="input-text" size="60" value="{$article.seo_keys}"></td>
      </tr>
      <tr>
        <th>{$Think.lang.seo_desc} :</th>
        <td><textarea name="seo_desc" id="seo_desc" cols="80" rows="8">{$article.seo_desc}</textarea></td>
      </tr>
    </table>
  </div>
  <div class="bk15"></div>
  <div class="btn">
    <input type="submit" value="{$Think.lang.submit}" name="dosubmit" class="button" id="dosubmit">
  </div>

</div>
</div>
</form>
<script type="text/javascript">
function SwapTab(name,cls_show,cls_hide,cnt,cur){
    for(i=1;i<=cnt;i++){
		if(i==cur){
			 $('#div_'+name+'_'+i).show();
			 $('#tab_'+name+'_'+i).attr('class',cls_show);
		}else{
			 $('#div_'+name+'_'+i).hide();
			 $('#tab_'+name+'_'+i).attr('class',cls_hide);
		}
	}
}
</script>
</body>
</html>